package com.nzw.controller.test;

import com.nzw.vo.common.HttpResult;
import org.apache.http.client.HttpRequestRetryHandler;
import sun.rmi.transport.proxy.HttpReceiveSocket;

import javax.websocket.*;
import java.io.IOException;
import java.util.Map;

/**
 * Created by Administrator on 2018/6/7/007.
 */

@ClientEndpoint()
public class Client {

    private Session session;


    @OnOpen
    public void onOpen(Session session) {

        System.out.println("服务器连接成功！");
    }

    @OnMessage
    public void onMessage(String message) {
        System.out.println("Client onMessage: " + message);
        if(message.equals("getOilFree")){

            System.out.println("查询未支付加油记录");

        }else if(message.equals("findcard")){

            System.out.println("通过手机查询ic卡");

        }else if(message.equals("bindCard")){

            System.out.println("绑定ic卡");

        }else if(message.equals("cancelCard")){

            System.out.println("解绑ic卡");

        }else if(message.equals("rechargeCard")){

            System.out.println("充值ic卡");

        }


    }


    public void sendMessage(String message) throws IOException {
        System.out.println("给客户端发送消息"+message);
        this.session.getBasicRemote().sendText(message);
    }



    @OnClose
    public void onClose() {}








}
